using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using XnaXaml.Xaml;

namespace XnaXaml.DemoApp
{
    public class Game1 :Game
    {
        #region Properties
        
        private GraphicsDeviceManager graphics;
        private GenericXamlRenderer xamlRenderer;

        #endregion

        #region Constructor
        
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Services.AddService(typeof(GraphicsDeviceManager), graphics);
        }

        #endregion

        #region Xna Methods
        
        protected override void Initialize()
        {
            xamlRenderer = new GenericXamlRenderer(this, "DefaultFont", "MainScreen");
            Components.Add(xamlRenderer);
            base.Initialize();
        }

        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) Exit();

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            base.Draw(gameTime);
        }

        #endregion
    }
}
